<template>
  <div id="app">
    <div class="loading" v-if="loadingVis">
      <div class="spinner_box">
        <Spinner type="bubbles" size='40px' style="fill: #fff;"></Spinner>
      </div>
    </div>
    <!-- 设置路由组件的视图位置 -->
    <!-- <router-view></router-view> -->
    <transition :name="transitionName">
      <keep-alive>
        <router-view v-if="$route.meta.keepAlive">
        </router-view>
      </keep-alive>
    </transition>
    <transition :name="transitionName">
      <router-view v-if="!$route.meta.keepAlive">
      </router-view>
    </transition>
    <FooterTabbar v-show="$route.meta.showFooter"></FooterTabbar>
  </div>
</template>
<script>
import FooterTabbar from "./components/FooterTabbar/FooterTabbar";
import { Spinner } from 'vux';
import { mapState } from "vuex";

export default {
  name: "app",
  data() {
    return {
      transitionName: "",
    };
  },
  computed: {
    ...mapState(["loadingVis"]),

  },
  mounted() {},
  components: {
    FooterTabbar,
    Spinner
  },
  // 自定义指令
  watch: {
    //使用watch 监听$router的变化
    $route(to, from) {
      //如果to索引大于from索引,判断为前进状态,反之则为后退状态
      if (to.meta.index > from.meta.index) {
        //设置动画名称
        this.transitionName = "slide-left";
      } else {
        this.transitionName = "slide-right";
      }
    }
  },
};

</script>
<style lang="less">
@import "~vux/src/styles/reset.less";
@import "./util/theme.less";

* {
  box-sizing: border-box;
}


html,
body,
#app {
  background-color: #f2f6f9;
  .be-full();
  font-size: 14px;
  color: @font-primary;
  position: relative;
}

.loading {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  .mix-flex-center();
  z-index: 99999;

  .spinner_box {
    width: 120px;
    height: 120px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 10px;
    .mix-flex-center();
  }
}

.vux-popover {
  left: auto !important;
  right: 5px !important;
}

.slide-right-enter-active,
.slide-right-leave-active,
.slide-left-enter-active,
.slide-left-leave-active {
  will-change: transform;
  transition: all 500ms;
  position: absolute;
}

.slide-right-enter {
  opacity: 0;
  transform: translate3d(-100%, 0, 0);
}

.slide-right-leave-active {
  opacity: 0;
  transform: translate3d(100%, 0, 0);
}

.slide-left-enter {
  opacity: 0;
  transform: translate3d(100%, 0, 0);
}

.slide-left-leave-active {
  opacity: 0;
  transform: translate3d(-100%, 0, 0);
}


/*定位动画*/
@-webkit-keyframes ball-scale-multiple {
  0% {
    -webkit-transform: scale(0);
    transform: scale(0);
    opacity: 0;
  }

  5% {
    opacity: 1;
  }

  100% {
    -webkit-transform: scale(1);
    transform: scale(1);
    opacity: 0;
  }
}

@keyframes ball-scale-multiple {
  0% {
    -webkit-transform: scale(0);
    transform: scale(0);
    opacity: 0;
  }

  5% {
    opacity: 1;
  }

  100% {
    -webkit-transform: scale(1);
    transform: scale(1);
    opacity: 0;
  }
}

.ball-scale-multiple {
  position: relative;
  -webkit-transform: translateY(-30px);
  -ms-transform: translateY(-30px);
  transform: translateY(-30px);
}

.ball-scale-multiple>div:nth-child(2) {
  -webkit-animation-delay: 0.2s;
  animation-delay: 0.2s;
}

.ball-scale-multiple>div:nth-child(3) {
  -webkit-animation-delay: 0.4s;
  animation-delay: 0.4s;
}

.ball-scale-multiple>div {
  background-color: #00b7e5;
  width: 15px;
  height: 15px;
  border-radius: 100%;
  margin: 2px;
  -webkit-animation-fill-mode: both;
  animation-fill-mode: both;
  position: absolute;
  left: 0px;
  top: 0px;
  opacity: 0;
  margin: 0;
  width: 60px;
  height: 60px;
  -webkit-animation: ball-scale-multiple 1s 0s linear infinite;
  animation: ball-scale-multiple 1s 0s linear infinite;
}


/*标注提示*/
.amap-marker-label {
  color: #fff;
  border: none;
  background-color: rgba(0, 0, 0, 0.7);
  white-space: nowrap;
  box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.3);
  border-radius: 4px;
  overflow: hidden;
  padding: 5px;

  // screenProject页面的label样式
  .screenProject-label {
    padding: 0.5vw;
    font-size: 1.2rem;
  }

  // label-info
  .label-info {
    // padding: 5px;
    // font-size: 14px;
    // line-height: 20px;
  }
}

// 遮住高德地图的logo
.amap-logo,
.amap-copyright {
  display: none;
  opacity: 0;
}

</style>
